package tech.aistar.corejava.day02;

import java.util.Scanner;

/**
 * Created by 李雨昂 on 2019/7/16.
 */
public class test {
    public static void main(String[] args) {
       /* double money = 10.0D;
        int cup = 5;
        //double sum = cup/2*(money+money/2) +cup%2*money;
        double sum = (cup/2+cup%2)*money + cup/2*money/2;
        System.out.println("sum = " + sum);*/
       /**
       * @Description:    java类作用描述:某年某月的最大天数
       * @Author:          lya
       * @CreateDate:     2019/7/16 14:48
       * @Version:        1.0
       */
       int year = 2012;
       Scanner sc=new Scanner(System.in);
        System.out.println("请输入月份:");
        int month = sc.nextInt();
        int[] days = new int[]{31,29,31,30,31,30,31,31,30,31,30,31};
        if(month >= 2){
            int sum = 0 ;
            if(year%400 == 0 || (year%4 == 0 && year%100!=0)){
                for(int i=0;i<month;i++){
                   sum = sum + days[i];
               }
               System.out.println(year+"年"+month+"月最大的天数为:"+sum);
           }else {
                System.out.println(sum-1);
            }
       }else {
            System.out.println(days[0]);
        }



    }
}
